package com.fulihui.systemcore.dal.convertor;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.BeanUtils;

import com.fulihui.systemcore.dal.dataobj.PosCityDO;
import com.fulihui.systemcore.dto.PosCityDTO;

public class CityConv {
    private static final String[] ignore = { "id" };

    public static PosCityDO convert2DO(PosCityDTO mo_) {
        if (mo_ == null) {
            return null;
        }

        PosCityDO do_ = new PosCityDO();
        BeanUtils.copyProperties(mo_, do_, ignore);

        return do_;
    }

    public static PosCityDTO convert2DTO(PosCityDO do_) {
        if (do_ == null) {
            return null;
        }

        PosCityDTO mo_ = new PosCityDTO();
        BeanUtils.copyProperties(do_, mo_, ignore);

        return mo_;
    }

    public static List<PosCityDTO> convert2List(List<PosCityDO> list) {
        return list.stream().map((t) -> {
            return convert2DTO(t);
        }).collect(Collectors.toList());
    }
}